-- pick_up
-- create by cheny3
-- 拾取物品

return {
    -- 判断
    canTrigger = function(args)
        -- 判断有没有物品
        local items = AutoFightM.getData()["items"];
        if items and #items > 0 then
            return true;
        end
        return false;
    end,

    -- 触发
    trigger = function(args)
        local items = AutoFightM.getData()["items"];
        if not items or #items <= 0 then
            return false;
        end

        -- 拾取一个
        DungeonActionM.go("pick_item", items[1]);

        -- 抛出事件
        EventMgr.fire(event.PLAYER_MOVE, items[1]);
        return true;
    end,
};
